﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace KeYan.Service.Repository.Migrations
{
    public partial class v1 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "tb_user_service_info",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UserName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PassWord = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UserTel = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UserEmail = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Enable = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_user_service_info", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_user_service_orders",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UserId = table.Column<int>(type: "int", nullable: false),
                    ServeId = table.Column<int>(type: "int", nullable: false),
                    PayMentTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    BuyCount = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    OrderStatus = table.Column<int>(type: "int", nullable: false),
                    OrderNumber = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_user_service_orders", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_user_service_serve",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ServeName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ServeImg = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ServeIntroduce = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ServeSeckill = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    ServePrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    ServeValidity = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_user_service_serve", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_user_service_vaild",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UserId = table.Column<int>(type: "int", nullable: false),
                    ServeId = table.Column<int>(type: "int", nullable: false),
                    StartTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    EndTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_user_service_vaild", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "tb_user_service_info");

            migrationBuilder.DropTable(
                name: "tb_user_service_orders");

            migrationBuilder.DropTable(
                name: "tb_user_service_serve");

            migrationBuilder.DropTable(
                name: "tb_user_service_vaild");
        }
    }
}
